﻿<%
on error resume next

const SqlDriverType=1 '1:Access 2:MSSQL

const AccessName="#Database_db_jt_1107.mdb"
const relPath="./jtDatabase/"
const AccessPwd=""

const DatabaseName="#Database_db_jt_1107SQL"
const SqlLocalName="WJK"
const SqlUID="sa"
const SqlPWD="123456"

const dbBakSavePath="./backup_jtdb/"

const SysVersion="版权所有：<a href='http://www.czsoft.cc/' target='_blank'>采智科技</a><br>后台管理系统2012.06版"
const CopyRight="Copyright &copy; 2000 - 2011 <a href='http://shop35319304.taobao.com/' target='_blank'>淘宝采智</a>   Powered By 产品超市<a href='http://www.0370taobao.com/' target='_blank'>采智科技</a>"

dim fsoDirRange:fsoDirRange=Array("html","uploadfiles","backup_jtdb")  'FSO文件操作范围，如果有其他目录操作权限的请手动添加

dim connStr,db,conn

sub OpenConn(relJump)
	if SqlDriverType=1 then
		if relJump<>"" then
			if right(relJump,1)<>"/" then relJump=relJump&"/"
		end if
		if right(relPath,1)<>"/" then relPath=relPath&"/"
		db = relJump&relPath&AccessName
		connStr="Driver={Microsoft Access Driver (*.mdb)};DefaultDir=;DBQ="&server.mappath(db)&";"
		if AccessPwd<>"" then connStr=connStr&"pwd="&AccessPwd&"; "
	elseif SqlDriverType=2 then
		connStr = "Driver={SQL Server};server="&SqlLocalName&";uid="&SqlUID&";pwd="&SqlPWD&";database="&DatabaseName&";"
	end if
	set conn=server.createobject("Adodb.Connection")
	conn.open connStr
	if err then
		err.clear
		Set conn = Nothing
		Response.Write "Error : Failed connect to the database."
		Response.End
	end if
end sub

sub CloseConn()
	conn.close
	set conn=nothing
end sub
%>